1. Technical Field
The disclosure generally relates to keyboard scanning circuits, particularly to a keyboard scanning circuit capable of using fewer ports.
2. Description of Related Art
Traditionally, keyboards are widely used as input means for various electronic devices, such as computers, personal digital assistances (PDAs). Usually, a keyboard includes a plurality of keys capable of being pressed, and a scanning circuit with a row-column type structure. The row-column type structure, also called a switch matrix, is aligned with the keys. The scanning circuit includes a plurality of row wires and a plurality of column wires. The keys are set above intersections where the row wires cross the column wires. A plurality of switches are located at the intersections, with two contacts of each switch being electrically connected to one row wire and one column wire respectively. Therefore, when the key is pressed, the corresponding switch is closed. The row wire and the column wire corresponding to this switch are then electrically connected. When the scanning circuit scans, the column wires are set to either high or low, and the row wires are then used as output. As a result, which switch is closed can be determined.
Referring to FIG. 4, a conventional scanning circuit (not labeled) is used in a keyboard (not shown) having nine keys. The scanning circuit includes three row wires P1.1˜P1.3, three column wires P1.4˜P1.6, and three resistors R1˜R3. The row wires P1.1˜P1.3 and the column wires P1.4˜P1.6 form a switch matrix (not labeled) including nine intersections. Nine switches S1˜S9 are set at the intersections of the scanning circuit respectively, with two contacts of each switch connected to one row wire and one column row. One end of the resistor R1/R2/R3 is connected to one end of the row wire P1.1/P1.2/P1.3 respectively, another end of the resistor R1/R2/R3 is connected to ground. Each switch is normally open until its key is pressed. For example, when a key is pressed, a corresponding switch such as SI closes, the row wire P1.1 and the column wire P1.4 is electrically connected. When the key is released, the corresponding switch such as S1 opens again.
Furthermore, three input ports are electrically connected to ends of the row wires P1.1˜P1.3, respectively, and three output ports are electrically connected to ends of the column wires P1.4˜P1.6, respectively. During scanning, each input ports is sequentially set low. When one of the input ports P1.1˜P1.3 is set low, the rest of the input are set high. The output ports are checked to find out if any switch is closed. Therefore, pressed keys, which correspond to the switches, can be identified. As an example, if the input port of row wire P1.1 is set low, the rest of the ports of the row wires P1.2 and P1.3 are set high. The output port of the P1.4 is also low, and then the switch S1 is determined to be closed. Consequently, the pressed key corresponding to the switch S1 is identified.
In practice, the three input ports and the three output ports are generally provided by a single-chip microprocessor. However, providing a microprocessor with so many ports consumes too much space.
Therefore, there is room for improvement within the art.